﻿@using GP.Logic.Model
@model Doctor
@{
    ViewBag.Title = "Edit Doctor";
}

<h1>Edit Doctor</h1>

@Html.ValidationSummary(false, "Unsuccessful. Please correct the errors and try again.")

@using(Html.BeginForm(MVC.Doctor.Edit()))
{
    <p>
        @Html.HiddenFor(a => a.DocId)
        DocId: @Model.DocId
    </p>
    <p>
        Name: 
        @Html.EditorFor(a => a.Name)
        @Html.ValidationMessageFor(a => a.Name)
    </p>
    <p>
        LicensNr: 
        @Html.EditorFor(a => a.LicensNr)
        @Html.ValidationMessageFor(a => a.LicensNr)
    </p>
    <p>
        Email: 
        @Html.EditorFor(a => a.Email)
        @Html.ValidationMessageFor(a => a.Email)
    </p>
    <p>
        Phone: 
        @Html.EditorFor(a => a.Phone)
        @Html.ValidationMessageFor(a => a.Phone)
    </p>
    <p>
        <input type="submit" value="Save" />
    </p>
}


<hr />

<h2>Users</h2>

@Html.ActionLink("Create user", MVC.Doctor.CreateUser(Model.DocId))
<table>
    <tr>
        <th>Username</th>
        <th>Password</th>
        <th></th>
        <th></th>
    </tr>

@foreach (var user in Model.GpSysUsers)
{
    <tr>
        <td>@user.Username</td>
        <td>@user.Password</td>
        <td>@Html.ActionLink("Edit", MVC.Doctor.EditUser(user.UserId))</td>
        <td>@Html.ActionLink("Delete", MVC.Doctor.DeleteUser(user.UserId))</td>
    </tr>
}
</table>    